<template>
    <div class="">
        <div class="pr10">
            <div class="analyItem">
                <p class="analyItemTit tx-center">状态</p>
                <div class="analyItemCon">
                    <div class="analyItemCon clearfix" >

                    </div>
                </div>
            </div>
        </div>
        <div class="thinScroll pr10" v-scrollHeight="100">
            <router-link tag="div" :to="{path: routerPath('evaluationThree'), query:{}}" class="analyItem anItemBor"
                active-class="anItemBor-active">
                <p class="analyItemTit tx-center">评价</p>
                <div class="analyItemCon">
                    <div class="clearfix">

                    </div>
                </div>
            </router-link>

        </div>
        <div class="layerRtb-footer">
           <div class="analyItem">
                <p class="analyItemTit tx-center">处理</p>
                <div class="analyItemCon">

                </div>
           </div>
        </div>
    </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getPMUpgradeMsg, getAchievementMsg } from '../Resources/Api/index'
export default {
    data () {
        return {
            pmUpgrage: {},
            pmAchievement: {},
            money: 0,
            getToday: '',
            datys: ''
        }
    },
    created () {
        var time = new Date()
        this.getToday = time.getMonth() + 1
        var year = time.getFullYear()
        var month = time.getMonth() + 1
        this.datys = new Date(year, month, 0).getDate() - time.getDate()

        this.GetPMUpgrade()
        this.GetAchievement()
    },
    methods: {
        // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        },
        GetPMUpgrade () {
            let _this = this
            _this.pmUpgrage = []
            getPMUpgradeMsg({
                uid: this.leftInfo.uid
            }).then(results => {
                this.pmUpgrage = results.data.Body
            }).catch(error => {
                console.log(error)
            })
        },
        GetAchievement () {
            let _this = this
            _this.pmAchievement = []
            getAchievementMsg({
                uid: this.leftInfo.uid,
                state: 1
            }).then(results => {
                this.pmAchievement = results.data.Body
                if (this.pmAchievement != null) {
                    this.pmAchievement.forEach(element => {
                        this.money += element.grossProfitReceived
                    })
                }
            }).catch(error => {
                console.log(error)
            })
        }
    },
    computed: {
        ...mapGetters(['leftInfo'])
    },
    watch: {
        leftInfo () {
            this.money = 0
            this.GetPMUpgrade()
            this.GetAchievement()
        }
    }
}

</script>
